package com.film.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;
import com.film.service.ReviewPriaseService;
import com.film.service.impl.ReviewPriaseServiceImpl;

/**
 * 该控制类用来做取消点赞
 * @author 2119196781
 *
 */
@WebServlet("/clearReviewPriase.do")
public class ClearReviewPriaseController extends HttpServlet{
	private ReviewPriaseService reviewPriaseService = new ReviewPriaseServiceImpl();
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String uId = request.getParameter("uId");
		String revId = request.getParameter("revId");
		String praise = request.getParameter("praise");
		int u_id = Integer.parseInt(uId);
		int rev_id = Integer.parseInt(revId);
		int praises = Integer.parseInt(praise);
		int result = reviewPriaseService.deleteReviewPriase(u_id, rev_id,praises);
		
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("result", result);
		response.getWriter().write(jsonObject.toJSONString());
	}
}
